<template>
    <div class="iccidselect" :style="{minHeight:h+'px'}">
        <div class="img"><img :src="src"></div>
        <div class="all">
            <div class="inp">
                 <el-input v-model="input" placeholder="请输入卡号 / iccid "></el-input>
            </div>
            <div class="btn" @click="select">查询</div>
        </div>
    </div>
</template>

<script>
    import axios from "axios";
    export default{
    	name: 'iccidselect',
    	data(){
    		return{
    			input:"",
                h:"",
                type:"",
                have:false,
                src:"./static/img/boming.jpg"
    		}
    	},
    	created() {
    		var h = document.documentElement.clientHeight;
    		this.h = h;
            
            var m = document.documentElement.clientWidth / 6.4 + 'px';
                    document.documentElement.style.fontSize = m;
                    
            document.getElementsByTagName("title")[0].innerText = '金麦物联';
    	},
        methods:{
            select:function(){

                this.input = this.input.replace(/(^\s*)|(\s*$)/g, "")
                var that = this
                axios.get('/api/system/iccid/exist?iccid='+this.input)
                	.then(response => {
                		if(response.data.data == null){
                            if( this.$route.query.type == 1 ){
                                window.location.href="http://www.zhongyiiot.com/"
                            }
                            if( this.$route.query.type == 2 ){
                                 window.location.href="http://www.jdwlkjm2m.com/wlk/wlk/goIndex.do?department=yd&level=sys&pno_code=1001"
                            }
                            if( this.$route.query.type == 3 ){
                                 window.location.href="http://zlgzh.zym2m.cn/"
                            }
                            if( this.$route.query.type == 4 ){
                                 window.location.href="http://ka.jinmaiiot.com/iot/iotCeslogin.html"
                            }
                            if( this.$route.query.type == 5 ){
                                 window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx56d314b78b546ca2&redirect_uri=http%3A%2F%2Fwx.szcoolfish.com%2Fcoolfish%2Ftpl%2Fmain%2Fdist%2Findex.html%23%2FbindCard%3Fid%3D50&response_type=code&scope=snsapi_userinfo&state=1&connect_redirect=1#wechat_redirect"
                            }
                            if( this.$route.query.type == 6 ){
                                 window.location.href="http://www.zxnetec.cn/WeiXin/wlkindex.aspx"
                            }
                        }else{
                            // this.have = true
                            window.location.href=response.data.data.url
                        }
                	})
            },
            go:function(){
                window.location.href="http://www.huarenlvtu.cn/app/index.php?i=39&c=entry&m=ewei_shopv2&do=mobile&r=diypage&id=162&wxref=mp.weixin.qq.com#wechat_redirect"
            }
        }
    }
</script>

<style lang="scss" scoped>
	.iccidselect{
		margin: 0; padding: 0; 
        .img img{ width: 100%; display: block;}
        .all{ margin-top: 0.7rem; display: flex; justify-content: center; flex-wrap: wrap;
            .inp{ flex-basis: 5.2rem;
                .el-input__inner{ border: 0; border-bottom: 1px #159298 solid; border-radius: 0; background: url("../../../static/img/bomingicon.jpg") no-repeat; 
                background-size:0.35rem; padding-left: 0.7rem; background-position: 0.1rem 0rem;}
            }
            .btn{ flex-basis: 5.2rem; margin-top: 0.5rem; border-radius: 0.5rem; text-align: center; color: #fff; line-height: 40px; cursor: pointer; background: #159298; font-size: 16px;}
        }
		.el-button--primary{ margin-top: 20px; cursor: pointer}
	}
</style>
